#ifndef CONTACTLIST_H
#define CONTACTLIST_H

#include <QLabel>
#include <QListWidget>
#include <QVector>
#include <QWidget>
#include "userdata.h"
class ContactList : public QListWidget
{
    Q_OBJECT
public:
    ContactList(QWidget *parent = nullptr);
    void init();
    void addNewFriend(std::shared_ptr<FriendInfo>);
    void addNewFriends(QVector<std::shared_ptr<FriendInfo>> friendInfoList);
    void loadContact();

private:
    bool _loadPending;

private:
    void addTip(QString text);
private slots:
    // 收到好友申请认证通过消息
    void slot_receiveFriendAuth(std::shared_ptr<AuthInfo>);
    void slot_AgreeFriendApply(std::shared_ptr<AuthRsp>);
    // QWidget interface
protected:
    virtual void paintEvent(QPaintEvent *event) override;
signals:
    // 新的朋友标签显示小红点
    void sig_newFriendRedPointVisible(bool);
    // 显示用户申请列表页
    void sig_showFriendApplyPage();
    void sig_friendClicked(std::shared_ptr<FriendInfo>);

    // QWidget interface
protected:
    virtual void wheelEvent(QWheelEvent *event) override;

public:
    virtual bool eventFilter(QObject *watched, QEvent *event) override;
};

#endif // CONTACTLIST_H
